package com.trsvax.gwthello.client.gwtui.widgets;

import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.NodeList;
import com.google.gwt.i18n.client.Dictionary;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.DisclosurePanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.RootPanel;

public class DisclosurePanelWidget extends Composite {
	String id;
	Dictionary dictionary;

	public DisclosurePanelWidget(String id, Dictionary dictionary) {
		DisclosurePanel disclosurePanel = new DisclosurePanel();
		disclosurePanel.setAnimationEnabled(true);

		Element element = RootPanel.get(id).getElement();
		NodeList<Element> nl = element.getElementsByTagName("div");
		disclosurePanel.setHeader(new HTML(nl.getItem(0).getInnerHTML()));
		nl.getItem(0).setInnerHTML("");
		disclosurePanel.setContent(new HTML(nl.getItem(1).getInnerHTML()));
		nl.getItem(1).setInnerHTML("");
		initWidget(disclosurePanel);

	}
}
